* Hookup WriteFile on the stdout/stderr in a child process to force file buffer
  flush on each write. Can fix a progress stall based on stdout/stderr
  buffering.

* Hookup SEH exception filter in a child process to intercept SEH exception
  being throwed out of a child process to be able to pause-on-error in the
  parent `callf.exe` process even if a child process didn't return non zero
  return code.

* Fix standard handle addresses table layout with a rearrange issue by a
  workaround:

  1. Get injected into parent process being used for console window attachment
     and directly call `GetStdHandle` functions to read standard handle
     addresses layout to update the standard handles (call `SetStdHandle`) in
     the process, where console is attached.

  2. Rewrite _sanitize_std_handles_nolock to call Win32 DuplicateHandle
     on GetStdHandle at first and call to _detach_crt_*_nolock at second.
     Based on the idea that the GetStdHandle returns a rearranged address which
     may be not a fact.

  3. Because the issue does appear only when the `/elevate` or
     `/shell-exec runas` is used and the parent process console window with not
     elevated previliges is attached from a child elevated process, then use a
     shared memory block with autogenerated name with the parent process id to
     store the parent this-process standard handles layout to read it from a
     child this-process with elevated previliges.
     This will work ONLY if the process inheritance chain is retained as is and
     is not splitted by a closed process in the middle. Otherwise the shared
     memory block name would not be found by the parent process id.

* In `callfg` by default create/attach the console on demand if not yet
  attached or created, for example, in case of print into console because of an
  error. Add a flag to suppress such behaviour.
  In `callf` by default show if hidden or create if detached/not attached the
  console on demand the same way as for the `callfg`.

* Implement `/disable-parent-ctrl-signals` and `/disable-parent-ctrl-c-signal`
  through a parent process injection to avoid a parent process to close when it
  can not avoid it by itself.
  For example `mintty` process in Windows does close itself on ctrl-c press and
  terminates the child process too when the child process can run in
  interactive mode and should not close upon the ctrl-c press:
  `mintty.exe -e cmd.exe /k`

* Implement process injection related to the partially implemented
  `/use-stdin-as-piped-from-conin` flag.

* Implement options chaining additionally to options nesting
  (`/parent-opt1{ child1-opt1 }{ child2-opt1 }`):

  /base-opt1:opt2:opt3

* Optionally disable `\{` escape sequence expansion for the positional
  arguments in case of the `/no-subst-pos-vars` flag:

  /no-subst-pos-vars:/no-esc

* Add regular `/v:* <name> <value>` options to use additionally in the
  `/[un]elevate{ ... }[{ ... }]`, `/[pro|de]mote[-parent]{ ... }` options to
  be able to expand and/or to substitute variables in the `<value>`:

    /v:/E       <name> <value>
    /v:/EE      <name> <value>
    /v:/S       <name> <value>
    /v:/SE      <name> <value>
    /v:/E:/S    <name> <value>
    /v:/E:/SE   <name> <value>
    /v:/EE:/S   <name> <value>
    /v:/EE:/SE  <name> <value>

  Use `\` escape sequence as in the generic command line expansion.

  If a chained `/S*` or `/E*` option is used, then this turns off the expansion
  and/or substitution for the rest of `<name>` arguments if not specifically
  enabled.

* Change behaviour and disable by default variables substitution after an
  environment variable expansion:

    >
    callf.exe /v AAA 1{0}1 "" "cmd.exe /c echo.${AAA}" "x"

    Should print `1{0}1` instead of `1x1`.

  Add `/allow-subst-after-expand` to specifically enable it for all arguments.

  Add `/allow-subst-after-expand[<N>]` to enable it only for `<N>` argument.

  Use `/v:/S*` to specifically enable substitution AFTER expansion of `${AAA}
  for all arguments.

* Add ability for variables late expansion in case of process elevation to
  expand after the elevation in a child process:

  >
  callf /elevate{ }{ /v MY_ELEVATED_VAR 123 } "" "cmd.exe /k echo.%MY_ELEVATED_VAR%"

  or

  >
  callf /v MY_ELEVATED_VAR 123 /elevate "" "cmd.exe /k echo.%MY_ELEVATED_VAR%"

  NOTE:
    Beause elevation does execute through the `ShellExecuteEx` Win32 API which
    does not support explicit environment variables setup, then we use the
    parent process shared memory to setup the environment variables.

* Improve rearranged output between stdout and stderr while being redirected,
  by saving stdout and stderr read/write times as a key to resort the output.

* Add
  `/set-lang-ids <id1-hex>[,<id2-hex>[,...]]` and
  `/set-lang-names <name1>[,<name2>[,...]]` to call
  `SetProcessPreferredUILanguages` to set preferred UI languages.

  For en-US and en:

  >
  callf /set-lang-ids 0409,0009 "" "..."

  >
  callf /set-lang-names en-US,en "" "..."

* Add
  `/runas-user <user>`
  to run under different user with system password input dialog.

* Add ability to run specifically as System Local account:
  `/runas-local-system`

  Example: https://github.com/zodiacon/sysrun/blob/master/sysrun.cpp

* Add `/cpu-affinity-mask <number>` option to execute child process on specific
  CPU cores.

* avoid redundant `{` character escaping in expressions like:

  >
  callf.exe /no-expand-env /S1 "" "\"{0}\bin\bash.exe\" -c \"\{ \\\"{1}/bin/env.exe\\\" }\"" "%CYGWIN_ROOT:/=\%" "%CYGWIN_ROOT:\=/%"

  The `{ ` treated as a part of a variable substitution even if start by not
  a number character, so the following `{1}` expression does not substitute.

  Use instead:

  >
  callf.exe /no-expand-env /S1 "" "\"{0}\bin\bash.exe\" -c \"{ \\\"{1}/bin/env.exe\\\" }\"" "%CYGWIN_ROOT:/=\%" "%CYGWIN_ROOT:\=/%"

  by using an inner text format check with or without `/no-esc` flag:

  {<number>}
  {*[:<number>[:<number>]]}
  {@[:<number>[:<number>]]}

  In all other cases - skip substitution. This will leave an argument variable
  placeholder with a random inner text as the above `{ \\\"{1}` - as is.

* add `/no-expand-env` flag to this-child process command line by default in
  case of `/elevate` usage to avoid accidental environment variable value
  double expansion of `AAA` into value of `CCC`:

  AAA=${BBB}
  BBB=${CCC}
  CCC=...

  Add flag `/elevate{ ... }{ /allow-expand-env }` to specifically remove
  default `/no-expand-env` flag from this-child process command line.

* add `/rr <from> <to>` and `/rra <from> <to>` variants to replace after
  environment variables expansion and argument variables substitution:

  /replace-late-args-in-tail <from> <to>
  /rra <from> <to>
    Replace `<from>` string by `<to>` string after expansion and substitution
    in tail command line arguments (arguments arter the first one).

  /replace-late-args <from> <to>
  /replace-late-arg<N> <from> <to>
  /rr <from> <to>
  /rr<N> <from> <to>
    Replace `<from>` string by `<to>` string after expansion and substitution
    for either all command line arguments or `<N>` command line argument, where
    `<N>` >= 0.
    If `<N>` is used and `<N>` >= 2, then the replace happens before
    substitution in first 2 fixed arguments.

* add arguments range operator for `{*}` and `{@}` variable arguments into
  replace options:

  /r:* <from> <to>
  /r:@ <from> <to>

  /rr:* <from> <to>
  /rr:@ <from> <to>

* add ability to use `{*}` and `{@}` variables with the range operator:

  Format:

    {*[:<from>[:<len>]]}
    {@[:<from>[:<len>]]}

    , where: `<from>` >= 1 (as in unix shell)

  `{*:2}` is equivalent to `{@:1}`

  `/shift-N` option has no effect on the range operator and shifts only `{*}`
  and `{@}` variables.

* add `{*}` and `{@}` variables range operator to other options:

  Single option with arguments range operator:

  /r:*:2:2 <from> <to>
  /r:@:1:2 <from> <to>

  /rr:*:2:2 <from> <to>
  /rr:@:1:2 <from> <to>

  /expand-env-arg:*:2:2 /E:*:2:2
  /expand-env-arg:@:1:2 /E:@:1:2
  /EE:*:2:2
  /EE:@:1:2
  /subst-vars-arg:*:2:2 /S:*:2:2
  /subst-vars-arg:@:1:2 /S:@:1:2
  /SE:*:2:2
  /SE:@:1:2

  Chained options with arguments range operator:

  /v:/E:*:2:2       <name> <value>
  /v:/EE:*:2:2      <name> <value>
  /v:/S:*:2:2       <name> <value>
  /v:/SE:*:2:2      <name> <value>
  /v:/E:/S:*:2:2    <name> <value>
  /v:/E:/SE:*:2:2   <name> <value>
  /v:/EE:/S:*:2:2   <name> <value>
  /v:/EE:/SE:*:2:2  <name> <value>

  /v:/E:@:1:2       <name> <value>
  /v:/EE:@:1:2      <name> <value>
  /v:/S:@:1:2       <name> <value>
  /v:/SE:@:1:2      <name> <value>
  /v:/E:/S:@:1:2    <name> <value>
  /v:/E:/SE:@:1:2   <name> <value>
  /v:/EE:/S:@:1:2   <name> <value>
  /v:/EE:/SE:@:1:2  <name> <value>

* add `/create-console-hidden` flag to create a hidden console and use it
  together with the `/pause-on-exit*`.

  If a child process will exit with not zero exit code, then show the console
  window and pause.

* add `/use-winxp-api` flag to fallback onto Windows XP Win32 API utilization
  in case of a higher Windows version.

* rearrange evaluated command line for the `/elevate*` and `/unelevate*`
  options.
  For example, group `/v ...` options together and move them to the beginning
  of the translated command line.

* add `/subst-short-path-if-gt-limit <limit>` to automatically scan command
  line for long paths longer than the <limit> and substitute them by a shot
  path (path must exist).

  Has effect only on absolute paths in format of `<drive>:\...`.

  Can not be used together with `/subst-unc-path-if-gt-limit` option.

* add `/subst-unc-path-if-gt-limit <limit>` to automatically scan command
  line for long paths longer than the <limit> and substitute them by a UNC
  path (path must exist) in format `\\?\<drive>:\...`.

  Has effect only on absolute paths in format of `<drive>:\...`.

  Can not be used together with `/subst-short-path-if-gt-limit` option.

===============================================================================
These flags already partially added into `help.tpl`, but still is not implemented:
===============================================================================

* /disable-wow64-fs-redir-if-this-proc-x86
  /promote{ /disable-wow64-fs-redir-if-this-proc-x86 }
  /promote-parent{ /disable-wow64-fs-redir-if-this-proc-x86 }

  Add 64-bit version of callf:

  - callf64.exe
  - callfg64.exe

  Add for all executables `/disable-wow64-fs-redir-if-this-proc-x86` to
  additionally disable WOW64 file system redirection in case of 32-bit
  this-process.

  Add `/runas-parent-bitness` to automatically choose 32-bit or 64-bit version
  based on parent process bitness. If bitness is the same then, the flag has no
  effect.

  If (un)elevation is enabled and going to be executed, and the parent process
  has a different bitness model, then run the same parent bitness callf
  executable variant before the (un)elevation.

  If (un)elevation is not enabled or not going to be executed, and the parent
  process has a different bitness model, then:

    If parent is 32-bit executable (this-process is 64-bit executable -
    callf64.exe/callfg64.exe), then run 32-bit callf executable variant
    - callf.exe/callfg.exe.

    If parent is 64-bit executable (this-process is 32-bit executable -
    callf.exe/callfg.exe), then the `/runas-parent-bitness` flag implies and
    works as the `/disable-wow64-fs-redir-if-this-proc-x86` or
    `/disable-wow64-fs-redir` flags, where the 64-bit callf this-process just
    executes a child process without wow64 redirection (no need to run 32-bit
    callf this-child).

  Add batch scripts to automatically select 32-bit or 64-bit version of callf
  executable:

  - callf.bat
  - callfg.bat

* Add `/allow-subst-pos-vars-after-env-var-expand` and disable by default
  positional variables substitution after environment variables expansion.

* Add `/print-to-stderr` to redirect all stdandard output from the `callf*.exe`
  process itself into error output.
  For example, `/pause-on-*` flags does print into stdout and can be redirected
  with this flag.

* Add `/cpu-affinity-mask <number>` option to execute child process on specific
  CPU cores.

* Add variants of `/E`, `/EE`, `/S`, `/SE` and etc for `{*}` and
  `{@}` variable arguments:

  /expand-env-arg:* /E:*
  /expand-env-arg:@ /E:@
  /EE:*
  /EE:@
  /subst-vars-arg:* /S:*
  /subst-vars-arg:@ /S:@
  /SE:*
  /SE:@

* Improve child wait functionality even if the first child process does close
  after run another child processes.

  Add flag `/wait-child-tree` to inject and wait to close all the children
  processes, not only the first child process.

  Add flag `/retain-child-tree` to inject and hold for exit all the children
  processes until the last child would close. When the last child process does
  exit, then does unlock all the children processes for exit.

* Add optional flag - `/+` to await ONLY not positional parameters until the
  `//` flag.
  Return an error if `//` is not found after `/+` or found more than once.
  Return an error if `/+` is found before `//` more than once.
  Return an error if not a flag parameter is found between `/+` and `//`
  arguments.
  This is useful to accept not positional parameters in the command line as an
  external (expandable) string.

* If run as `callfg.exe ... /pause-on-exit-if-error ... "" "cmd.exe ..."`, when
  there were no console before the `callfg.exe` call, then the `conhost.exe`
  does close when closes the child `cmd.exe` process and `callfg.exe` skips the
  pause because there is no inherited console to attach with.

  To be able to keep use of the pause in the parent process, we can inject into
  child process and intercept the owned console detach to reattach it to parent
  `callfg.exe` process. This will let the pause works as expected even in the
  `callfg.exe` process without the owned or attached console window before the
  child execution.

  Add `/allow-child-console-ownership-reaquire` flag to enable this.

  Add `/allow-child-console-ownership-reaquire-recursively` flag to enable this
  for all children processes (recursive injection including all `callf*.exe`
  child processes in process inheritance chain).
